module.exports = function(sequelize, DataTypes) {
    const workflow = sequelize.define('worknote', {
        user_id: {
            type: DataTypes.INTEGER(20).UNSIGNED
        },
        workflow_id: {
            type: DataTypes.STRING
        },
        transaction_id: {
            type: DataTypes.STRING,
            allowNull: false
        },
        remarks: {
            type: DataTypes.TEXT,
        },
        step: {
            type: DataTypes.ENUM,
            allowNull: false,
            values: [
                'preparation',
                'precheck',
                'precheck_pass',
                'precheck_reject',
                'complete',
                'complete_part',
                'complete_pass',
                'postcheck',
                'postcheck_pass',
                'postcheck_reject'
            ],
        },

        created_at: {
            type: DataTypes.DATE
        }
    }, {
        tableName: 'sophic_worknotes',

        underscored: true,

        updatedAt: false,

        indexes: [{
            fields: ['step']
        }, {
            fields: ['created_at']
        }]
    })

    return workflow
}